package com.hyb.algorithm.data.struct.list;

/**
 * @Author: huyanbing
 * @Date: 2021/9/5 3:29 下午
 */
public class Reverse {

    public static void main(String[] args) {

    }

    public ListNode reverse(ListNode head) {

        if (head.next == null) {
            return head;
        }

        ListNode last = reverse(head.next);
        head.next.next = head;
        head.next = null;
        return last;

    }
}
